<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateYqProductTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('yq_product')) {
            Schema::create('yq_product', function (Blueprint $table) {
                $table->increments('id');
                $table->integer('site_id')->default(0);
                $table->string('name')->comment('产品名称');
                $table->integer('cid')->default(0)->comment('分类ID');
                $table->integer('display_order')->default(0)->nullable()->comment('排序');
                $table->string('sku',5)->default('')->nullable()->comment('产品单位');
                $table->tinyInteger('is_recommend')->default(0)->nullable()->comment('是否推荐:0-否;1-是');
                $table->tinyInteger('is_new')->default(0)->nullable()->comment('是否新上:0-否;1-是');
                $table->tinyInteger('is_hot')->default(0)->nullable()->comment('是否热卖:0-否;1-是');
                $table->string('thumb')->default('')->nullable()->comment('产品缩略图');
                $table->text('images')->nullable()->comment('产品图片');
                $table->decimal('price', 14,2)->default(0.00)->comment('产品现价');
                $table->decimal('market_price', 14,2)->default(0.00)->nullable()->comment('产品原价');
                $table->tinyInteger('is_show_price')->default(0)->nullable()->comment('是否显示价格:0-否;1-是');
                $table->string('price_desc')->default('')->nullable()->comment('价格显示位置文案');
                $table->tinyInteger('status')->default(0)->comment('是否上架:0-否;1-是');
                $table->longText('description')->nullable()->comment('产品描述');
                $table->integer('created_at')->nullable();
                $table->integer('updated_at')->nullable();
                $table->integer('deleted_at')->nullable();
            });
            \Illuminate\Support\Facades\DB::statement("ALTER TABLE `" . app('db')->getTablePrefix() . "yq_product` comment '产品--产品表'");
        }
    }


    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('yq_product');
    }

}
